<?php
	//后台日志记录控制器
class LogControl extends checkLogin{
	function index(){}

	//后台操作日志记录
	function actLog(){
		$db = M('actlog');
		$total = $db->count();
		$page = new page($total,10);
		$result = $db->order('addtime desc')->all($page->limit());

		$this->assign('list',$result);
		$this->assign('page',$page->show());
		$this->display();
	}

	//删除操作日志记录
	function delActLog(){
		$id = @$_GET['id'];
		if(empty($id)){
			go(__CONTROL__.'/actLog');
			return false;
		}
		$db = M('actlog');
		if($db->del($id)){
			$this->success('删除成功',__CONTROL__.'/actLog');
			exit;
		}else{
			$this->success('删除失败',__CONTROL__.'/actLog');
			exit;
		}
	}
	//后台登录日志记录
	function loginLog(){
		$db = M('loginlog');
		$total = $db->count();
		$page = new page($total,10);
		$result = $db->order('logintime desc')->all($page->limit());

		$this->assign('list',$result);
		$this->assign('page',$page->show());
		$this->display();
	}
	//删除登录日志
	function delLoginLog(){
		$id = @$_GET['id'];
		if(empty($id)){
			go(__CONTROL__.'/loginLog');
			return false;
		}
		$db = M('loginlog');
		if($db->del($id)){
			$this->success('删除成功',__CONTROL__.'/loginLog');
			exit;
		}else{
			$this->success('删除失败',__CONTROL__.'/loginLog');
			exit;
		}
	}
}
?>